package nc.hw;

public class HJ33 {

    private static int ipToInteger(String ip) {
        String[] split = ip.split("\\.");
        int value = 0;
        for (String s : split) {
            value = value * 256 + Integer.parseInt(s);
        }
        return value;
    }

    private static String integerToIp(Integer value) {
        String[] ips = new String[4];
        for (int i = 3; i >= 0; i--) {
            ips[i] = String.valueOf(value % 256);
            value = value / 256;
        }
        return String.join(".", ips);
    }

    public static void main(String[] args) {
        System.out.println(ipToInteger("10.0.3.193"));
        System.out.println(integerToIp(167969729));
    }

}
